<!DOCTYPE html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('文件上传')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>上传文件</h5>
                </div>
                <div class="ibox-content">
                    <div class="form-group">
                        <input type="hidden" id="serverType" th:value="${serverType}">
                        <label class="font-noraml">多文件上传</label>
                        <div class="file-loading">
                            <input id="fileUpload" name="file" type="file" value="11" multiple>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" value="111" id="ttt">
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    $(document).ready(function () {
        $("#fileUpload").fileinput({
            theme: 'explorer-fas',
            uploadUrl: '/file/image/add',
            overwriteInitial: false,
            // allowedFileExtensions: ["jpg", "png", "jpeg", "bmp"],
            initialPreviewAsData: true,
            uploadExtraData: {
                "serverType": $("#serverType").val()//参数
            }
        });
    });
    //异步上传返回结果处理
    $("#fileUpload").on("fileuploaded", function (event, data, previewId, index) {
        var response = data.response;
        if (response.code == web_status.FAIL) {
            $.modal.alertError(response.msg);
        }
        console.log(data);
    });
</script>
</body>
</html>
